<template>
  <div class="Recommend">
    <div class="GoMap">
        <van-swipe >
  <van-swipe-item ><img src="img/lun01.jpg" alt="" ></van-swipe-item>
  <van-swipe-item><img src="img/lun02.jpg" alt=""></van-swipe-item>
  <van-swipe-item><img src="img/lun03.jpg" alt=""></van-swipe-item>
  
</van-swipe>
    </div>
    <div class="classify">
      <span v-for="(v, i) in this.$store.state.Purchase.arr" :key="i">
        <img :src="v.imgs" alt="" />
        <br>
        {{ v.classify }}</span
      >
    </div>
    <div class="centent-top">
      <span>
        <p>点石成金</p>

        合成领鞋
        <img src="img/dianshi01.jpg" alt="">
      </span>
      <span>
        <p>拆盲盒</p>

        免费领物
        <img src="img/dianshi02.jpg" alt="">
      </span>
      <span>
        <p>天天领劵</p>

        再抽50元
        <img src="img/dianshi03.jpg" alt="">
      </span>
      <span>
        <p>十连抽</p>
        谁是欧皇
        <img src="img/dianshi04.jpg" alt="">
      </span>
    </div>

    <div class="centent">
      <div
        class="centents"
        v-for="(v, i) in this.$store.state.Purchase.arr1"
        :key="i"
        @click="pushs(i)"
      >
        <img v-lazy="v.imgs" alt="" />

        <p>{{ v.classify | lengths }}</p>
        <p>
          <span>{{ v.price }}</span
          ><span>{{ v.number }}人付款</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  created() {
    this.$store.dispatch("getapione", { url: "/Purchase/Purchaseone" });
    this.$store.dispatch("getapitwo", { url: "/Purchase/Purchasetwo" });
  },
     filters:{
        lengths(val){
            if(val.length>8){
                return val.substr(0,16)+".."
            }else{
                return val
            }
            
        }
    },
    methods:{
      pushs(id){
        this.$router.push({name:"RP",query:{RPid:JSON.stringify(this.$store.state.Purchase.arr1[id])}})
      }
     
    },
    
  
};
</script>

<style scoped>
.centent {
  width: 90%;
  min-height: 6rem;
  display: flex;
  flex-wrap: wrap;
  margin: auto;
  margin-bottom: 0.5rem;
  justify-content: center;
}
.centents {
  border-bottom: .01rem solid rgb(230, 229, 229);
  width: 43%;
  min-height: 1rem;
  margin-top: 0.1rem;
  padding: 0.1rem;
}
.centents:nth-child(odd) {
  border-right: .01rem solid rgb(230, 229, 229);
}
.centents p:nth-child(2) {
  text-align: center;
  font-size: 0.1rem;
}
.centents p:nth-child(3) {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.1rem;
  line-height: 0.4rem;
  font-size: 0.1rem;
}
.centents p:nth-child(3) span:nth-child(1) {
  font-weight: bolder;
  font-size: .13rem;
}
.centents p:nth-child(3) span:nth-child(2) {
  color: rgb(114, 114, 114);
}
.centents img {
  width: 60%;
  margin-left: 20%;
  height: 50%;
}
.centent-top {
  width: 90%;
  margin: auto;
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  color: rgb(61, 60, 60);
}
.centent-top p {
  font-size: 0.12rem;
  margin-top: 0.1rem;
  font-weight: bolder;
    color: black;
}
.centent-top span {
  width: 21%;
  height: 0.6rem;
  background: rgba(248, 246, 246, 0.932);
  padding-left: 0.07rem;
  font-size: 0.08rem;
  position: relative;
}
.centent-top span img{
  width: .2rem;
  height: .2rem;
  position: absolute;
  bottom: 0rem;
  right: 0rem;

}
.classify {
  min-height: 1rem;
  width: 90%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  background: white;
  margin-left: .2rem;
}
.classify span {
  margin-top: 0.3rem;
  width: 20%;
 
  min-height: 0.5rem;
  text-align: center;
  font-size: 0.06rem;
  font-weight: bold;
}
.classify img {
  width: 80%;
  height: 0.4rem;
}
.el-carousel__item:nth-child(n) {
  background-image: url("/img/lun01.jpg");
  background-size: 100%;
}

.el-carousel__item:nth-child(2n) {
  background-image: url("/img/lun02.jpg");
  background-size: 100%;
}
.el-carousel__item:nth-child(3n) {
  background-image: url("/img/lun03.jpg");
  background-size: 100%;
}
.GoMap {
  width: 90%;
  margin: auto;
}
.GoMap img{
  width: 100%;
  height: 100%;
}
</style>